﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JKF.BusinessLayer.BLL;
using JKF.Substructure;

namespace JKF.Web.Customer
{
    public partial class AdvancedSearch : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        private static StringBuilder sbBuilder = new StringBuilder();
        public string CurstomerLevelOption
        {
            get
            {
                var bllLevel = new bllDIC_LEVEL();
                var levels = bllLevel.GetModelList("");
                sbBuilder.Clear();
                foreach (var level in levels)
                {
                    sbBuilder.AppendFormat("<label><input type=\"checkbox\" nm=\"{1}\" value=\"{0}\">{1}</label>", level.LEVEL_CODE, Server.HtmlEncode(level.NAME));
                }
                return sbBuilder.ToString();
            }
        }

        public string CurstomerGroupOptions
        {
            get
            {
                var groupbll = new bllDIC_GROUP();
                var result = groupbll.GetListArray(string.Format(" SHOP_CODE='{0}' ", bllSYS_USER.CurrentUser.SHOP_CODE));
                sbBuilder.Clear();
                foreach (var groups in result)
                {
                    sbBuilder.AppendFormat("<label><input type=\"checkbox\" nm=\"{1}\" value=\"{0}\">{1}</label>", groups.GROUP_KEY, Server.HtmlEncode(groups.NAME));
                }
                return sbBuilder.ToString();
            }
        }

        public string Province
        {
            get
            {
                var bllArea = new bllDIC_AREA();
                return bllArea.GetProvince();
            }
        }

        //public string CustomerInfo
        //{
        //    get
        //    {
        //        var customerKey = P("customerKey");
        //        if (customerKey.IsGuidB())
        //        {
        //            var bllCustomer = new bllCUSTOMER();
        //            return bllCustomer.GetModel(customerKey.ToGuid()).ToJson();
        //        }
        //        return "null";
        //    }
        //}
        //public string ShopOptions
        //{
        //    get
        //    {
        //        var bllshop = new bllSHOP();
        //        sbBuilder.Clear();
        //        var shops = bllshop.GetListArray("");
        //        foreach (var shop in shops)
        //        {
        //            sbBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", Server.HtmlEncode(shop.SHOP_CODE), Server.HtmlEncode(shop.SHOP_NAME));
        //        }
        //        return sbBuilder.ToString();
        //    }
        //}
    }
}